define(['swiper','jquery'], (Swiper) => {
    class SwiperRoll {
       constructor(index){
          this.index=index
          this.init()
       }
       init(){
        const mySwiper =(this.index,{
            autoplay: {
                delay: 2000
              },
              // autoplayStopOnLast : false,
              loop: true, // 循环模式选项
              speed: 300,
              // 如果需要分页器
              pagination: {
    
                el: this.index,
        
                type: 'custom',
        
                autoplayDisableOnInteraction : false,
        
                renderCustom: function (swiper, current, total) {
                  var paginationHtml = "";
                  for (var i = 0; i < total; i++) {
                    // 判断是不是激活焦点，是的话添加active类，不是就只添加基本样式类
                    if (i === (current - 1)) {
                      paginationHtml += '<span class="swiper-pagination-customs swiper-pagination-customs-active"></span>';
                    }else{
                      paginationHtml += '<span class="swiper-pagination-customs"></span>';
                    }						  
                  }
                  return paginationHtml;
                },
              },
              // 如果需要前进后退按钮
              navigation: {
                nextEl: '.banner .swiper-button-next',
                prevEl: '.banner .swiper-button-prev',
              },
        })
           return mySwiper
         
       }
    }
})